package com.weiqiao.report.distributior.rest;

import com.weiqiao.aop.log.Log;
import com.weiqiao.report.distributior.Service.IDistributionReportService;
import com.weiqiao.report.distributior.domain.dto.UserReportEntityDTO;
import com.weiqiao.report.distributior.domain.vo.UserReportVO;
import com.weiqiao.utils.PageUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/report")
public class DistributionController {
    @Autowired
    private IDistributionReportService distributionReportService;

    @Log("分销记录列表")
    @GetMapping("/distribution-list")
    public ResponseEntity getOrderList(UserReportVO vo) {
        List<UserReportEntityDTO> list = distributionReportService.getDistributionList(vo);
        int count = distributionReportService.countNum(vo);
        return new ResponseEntity(PageUtil.toPage(list, count), HttpStatus.OK);
    }
}
